//
//  ViewController.m
//  FMDB
//
//  Created by 袁飞 on 2017/3/13.
//  Copyright © 2017年 Yuanfei. All rights reserved.
//

#import "ViewController.h"
#import "SqlitManager.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    
    [self insert];
    
}

//插入
- (void)insert {
    
    NSString *sql = @"insert into t_person(name, age) values(?, ?);";
    
    [[SqlitManager sharedManager] inDatabase:^(FMDatabase *db) {
        BOOL isOK = [db executeUpdate:sql, @"方正伟", @(22)];
        
        if (isOK) {
            NSLog(@"插入成功");
        } else {
            NSLog(@"插入失败");
        }
        
    }];
}

@end
